<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>File Source for escape.test.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
						<h1>Source for file escape.test.php</h1>
<p>Documentation is available at <a href="../FPDF5/_tests---escape.test.php.html">escape.test.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line"><a name="a2"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-var">$arr_test_strings&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a4"></a>&nbsp;&nbsp;&nbsp;<span class="src-str">'abc123'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a5"></a>&nbsp;&nbsp;&nbsp;<span class="src-str">&quot;don\'t&quot;</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a6"></a>&nbsp;&nbsp;&nbsp;<span class="src-str">'How&nbsp;(about)&nbsp;it!'</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a7"></a>&nbsp;&nbsp;&nbsp;<span class="src-str">'A&nbsp;carriage&nbsp;'&nbsp;</span>.&nbsp;<span class="src-str">&quot;\r&quot;&nbsp;</span>.&nbsp;<span class="src-str">'&nbsp;return'</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a9"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-key">foreach&nbsp;</span><span class="src-sym">(</span><span class="src-var">$arr_test_strings&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$int_test&nbsp;</span>=&gt;&nbsp;<span class="src-var">$str_test_string</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a11"></a>&nbsp;&nbsp;&nbsp;<span class="src-var">$str_out_a&nbsp;</span>=&nbsp;<a href="../FPDF5/_tests---escape.test.php.html#function_escape">_escape</a><span class="src-sym">(</span><span class="src-var">$str_test_string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a12"></a>&nbsp;&nbsp;&nbsp;<span class="src-var">$str_out_b&nbsp;</span>=&nbsp;<a href="../FPDF5/_tests---escape.test.php.html#functionescape">escape</a><span class="src-sym">(</span><span class="src-var">$str_test_string</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a13"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a14"></a>&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;</span><span class="src-str">\r\n{<span class="src-var">$int_test</span><span class="src-sym">}</span>.&nbsp;</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a15"></a>&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$str_out_a&nbsp;</span>!=&nbsp;<span class="src-var">$str_out_b</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a16"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;</span><span class="src-str">FAIL:&nbsp;{<span class="src-var">$str_test_string</span><span class="src-sym">}</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a17"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;</span><span class="src-str">&nbsp;&nbsp;&nbsp;FPDF&nbsp;1.6&nbsp;gives:&nbsp;&nbsp;&nbsp;{<span class="src-var">$str_out_a</span><span class="src-sym">}</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a18"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;</span><span class="src-str">&nbsp;&nbsp;&nbsp;FPDF-5&nbsp;gives:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<span class="src-var">$str_out_b</span><span class="src-sym">}</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a19"></a>&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a20"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;Pass\r\n&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a21"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">&quot;</span><span class="src-str">&nbsp;&nbsp;&nbsp;:&nbsp;{<span class="src-var">$str_out_a</span><span class="src-sym">}</span>&nbsp;==&nbsp;{<span class="src-var">$str_out_b</span><span class="src-sym">}</span>\r\n</span><span class="src-str">&quot;</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a24"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a25"></a><span class="src-comm">//&nbsp;FPDF&nbsp;1.6&nbsp;Version</span></div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-key">function&nbsp;</span><a href="../FPDF5/_tests---escape.test.php.html#function_escape">_escape</a><span class="src-sym">(</span><span class="src-var">$s</span><span class="src-sym">)</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a28"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//Escape&nbsp;special&nbsp;characters&nbsp;in&nbsp;strings</span></div></li>
<li><div class="src-line"><a name="a29"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$s</span>=<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'\\'</span><span class="src-sym">,</span><span class="src-str">'\\\\'</span><span class="src-sym">,</span><span class="src-var">$s</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$s</span>=<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">'('</span><span class="src-sym">,</span><span class="src-str">'\\('</span><span class="src-sym">,</span><span class="src-var">$s</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a31"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$s</span>=<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">')'</span><span class="src-sym">,</span><span class="src-str">'\\)'</span><span class="src-sym">,</span><span class="src-var">$s</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$s</span>=<a href="http://www.php.net/str_replace">str_replace</a><span class="src-sym">(</span><span class="src-str">&quot;\r&quot;</span><span class="src-sym">,</span><span class="src-str">'\\r'</span><span class="src-sym">,</span><span class="src-var">$s</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$s</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a34"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a36"></a><span class="src-comm">//&nbsp;FPDF-5&nbsp;Version</span></div></li>
<li><div class="src-line"><a name="a37"></a><span class="src-key">function&nbsp;</span><a href="../FPDF5/_tests---escape.test.php.html#functionescape">escape</a><span class="src-sym">(</span><span class="src-var">$str_string</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$str_string&nbsp;</span>=&nbsp;<a href="http://www.php.net/preg_replace">preg_replace</a><span class="src-sym">(</span></div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'|\\\\|'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'|\(|'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'|\)|'</span><span class="src-sym">,&nbsp;</span><span class="src-str">&quot;|\\r|&quot;</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a40"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'\\\\\\\\'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'\\\\('</span><span class="src-sym">,&nbsp;</span><span class="src-str">'\\\\)'</span><span class="src-sym">,&nbsp;</span><span class="src-str">'\\\\r'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
<li><div class="src-line"><a name="a41"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$str_string</span></div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$str_string</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-sym">}</span></div></li>
</ol></div>
</div>
	<p class="notes" id="credit">
		Documentation generated on Thu, 22 Jul 2010 21:47:24 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.0a2</a>
	</p>
	</body>
</html>